﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Configuration;
using DropBoxClient.Entities;

namespace DropBoxClient.Tests
{
    [TestClass]
    public class GetFilesTest
    {
        private string accessToken;
        private FileContent file;

        [TestInitialize]
        public void Init()
        {
            accessToken = ConfigurationManager.AppSettings["AccessToken"];
            var client = new OAuth2Client(accessToken);
            file = client.GetFiles(StringConstants.SandboxRoot, "Test/Notes.txt");
        }

        [TestMethod]
        public void GetFiles_ResultIsNotNull()
        {
            Assert.IsNotNull(file);
        }

        [TestMethod]
        public void GetFiles_HasMeta()
        {
            Assert.IsNotNull(file.Meta);
        }

        [TestMethod]
        public void GetFileMeta_VerifyFile()
        {
            Assert.AreEqual(file.Meta.Bytes, file.Content.Length);
        }
    }
}
